Skip to content

Conversation

Monisha-official
Copy link

@Monisha-official Monisha-official commented Oct 9, 2025

  1. Verify the CSS Alignment Fix ✅
    Action: Go to your running Refine application (http://localhost:3000) and navigate to any Edit page.

Test: Slowly resize your browser window to simulate a mobile screen (make it very narrow).

Expected Result: The "Save" and "Delete" buttons in the footer should wrap neatly to a new line when space runs out, and both buttons should remain aligned to the right of the card footer.

  1. Verify the Authentication Loop Fix ✅
    Action: You need to trigger a session expiry or manually simulate an unauthorized state.

Test (Simulated):

Log in successfully.

Open your browser's Developer Tools → Application → Local Storage and delete the stored authToken (or whatever key you use).

Attempt to navigate to a restricted page or refresh the current page.

You should be redirected immediately to the /login page.

Expected Result: You should not see a flash of the main application or get stuck in a loop of redirects. The application should handle the session expiry cleanly and immediately land on the login screen.

Summary by Sourcery

Provide a sample refine authProvider implementation in place of the old README, including secure token storage, identity retrieval, and handling of expired sessions to prevent infinite redirects.

New Features:

  • Add a complete Refine AuthProvider implementation with login, logout, checkAuth, and getIdentity methods

Bug Fixes:

  • Fix infinite authentication redirect loop by handling 401/403 errors in onError and triggering logout

Documentation:

  • Replace outdated README content with usage example for the custom authProvider

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 9, 2025

Reviewer's Guide

This PR replaces the existing README documentation with a TypeScript authentication provider module, implementing core Refine auth methods and addressing an infinite-loop bug on session expiry.

Sequence diagram for session expiry and authentication loop fix

sequenceDiagram
    participant Browser
    participant "authProvider.onError()"
    participant "authProvider.logout()"
    participant "Refine Core"
    Browser->>"Refine Core": Request restricted page
    "Refine Core"->>"authProvider.checkAuth()": Check authentication
    "authProvider.checkAuth()"-->>"Refine Core": authenticated: false, redirectTo: /login
    "Refine Core"->>Browser: Redirect to /login
    Note over "authProvider.onError()","authProvider.logout()": On 401/403 error
    "Refine Core"->>"authProvider.onError()": Handle error
    "authProvider.onError()"-->>"Refine Core": { logout: true }
    "Refine Core"->>"authProvider.logout()": Logout
    "authProvider.logout()"-->>"Refine Core": success, redirectTo: /login
    "Refine Core"->>Browser: Redirect to /login
Loading

File-Level Changes

Change Details Files
Overhauled README.md by removing all existing docs and embedding an authProvider implementation
  • Stripped out project intro, badges, guides, and contribution sections
  • Added TypeScript authProvider code block to README.md
README.md
Defined AuthProvider methods to manage login state and persistence
  • login sends credentials, stores token, and handles redirects
  • logout clears storage and redirects to login
  • checkAuth checks token presence and redirects if missing
  • getIdentity retrieves user info from storage
README.md
Implemented onError handler to fix infinite authentication redirect loop
  • Extracts HTTP status from error object
  • Returns {logout: true} on 401/403 to trigger proper logout
  • Prevents looping by ensuring a single redirect to login
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant